// @ts-ignore

/* eslint-disable */
import { request } from "umi";
/** 获取当前的用户 GET /api/currentUser */

export async function getList(params, options) {
  return request("/baseApi/handletask/dataHandleTaskPage", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 详情
export async function getDetail(params, options) {
  return request("/baseApi/handletask/getWorkById", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 详情sql
export async function getSqlDetail(params, options) {
  return request("/baseApi/handletask/getDictionaryById", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// sql 查询
export async function upadataField(body, options) {
  return request("/baseApi/originalitem/executesql", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

// 类别列表
export async function getTree(params, options) {
  return request("/baseApi/goalcatalogue/getDataCatalogueList", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 库列表
export async function getSourcedataList(params, options) {
  return request("/baseApi/goaldataresource/getDataResourceList", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 增加 库数据项
export async function addItemField(body, options) {
  return request("/baseApi/handletask/addOrUpWork", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

export async function upadataItemField(body, options) {
  return request("/baseApi/handletask/addOrUpWork", {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

// 任务列表
export async function getCreditTypeList(params, options) {
  return request("/baseApi/credittype/getCreditTypeList", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 获取映射字段
export async function getMappingByTableid(params, options) {
  return request("/baseApi/collectionitem/getMappingByTableid", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 生成缺省字段
export async function createStructurebybaseTable(params, options) {
  return request("/baseApi/collectionitem/createStructurebybaseTable", {
    method: "GET",
    params: { ...params },
    ...(options || {}),
  });
}

// 增加 保存
export async function savaFile(body, options) {
  return request("/baseApi/collectionitem/addMapping", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

// 删除
export async function removeMenu(options) {
  return request(`/baseApi/handletask/delete/${options}`, {
    method: "DELETE",
  });
}
